# This file implements a severity map. It allows you to convert between severities and classes,
# this allows no duplicates in either the keys or values thus the first value is taken in that case.

our %toClassifier = ();
our %fromClassifier = ();

# Add a severity to the severity map.
sub addToSeverityMap {
  my ($from, $to) = @_;
 
  # Only insert the first one to avoid duplicates
  
  unless (exists $toClassifier{$from})
  {
	$toClassifier{$from} = $to;
  }
 
  unless (exists $fromClassifier{$to})
  {
    $fromClassifier{$to} = $from;
  }
}

# Read the severity map from a file.
open (FILE, "data/severityMap");
while (<FILE>)
{
	$line = $_;
	chomp($line);

	@splitLine = split(/:/, $line);
	
	addToSeverityMap($splitLine[0], $splitLine[1]);
}
close(FILE);

1;